#include "reg52.h"
#define DM P0

void delay(unsigned int x)
{
    while(x--);
}

sbit wmA = P2^2;
sbit wmB = P2^3;
sbit wmC = P2^4;

void display()
{
	int arr[8] = {0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f};
	int i = 0;
	for(i=0;i<=7;i++)
	{	
		switch(i)
		{
			 case 0:
			 wmC = 1;wmB = 1; wmA = 1;DM = arr[0];break;
			 case 1:
			 wmC = 1;wmB = 1; wmA = 0;DM = arr[1];break;
			 case 2:
			 wmC = 1;wmB = 0; wmA = 1;DM = arr[2];break;
			 case 3:
			 wmC = 1;wmB = 0; wmA = 0;DM = arr[3];break;
			 case 4:
			 wmC = 0;wmB = 1; wmA = 1;DM = arr[4];break;
			 case 5:
			 wmC = 0;wmB = 1; wmA = 0;DM = arr[5];break;
			 case 6:
			 wmC = 0;wmB = 0; wmA = 1;DM = arr[6];break;
			 case 7:
			 wmC = 0;wmB = 0; wmA = 0;DM = arr[7];break;	
		}
		delay(50);
	}	
}

void main()
{
    while(1)
    {
       display();
    }
}
